Skip to content

Say an app is already disconnected on Connected apps - #885

Merged
richshaw merged 6 commits into
mainfrom
claude/issue-882-disconnect-refusal
Nov 18, 2026
Merged

richshaw merged 6 commits into
mainfrom
claude/issue-882-disconnect-refusal

Conversation

@richshaw

@richshaw richshaw commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Fixes #882.

Rebuilt on main (option 1 in the hand-back comment). Since this PR first opened, main moved the page under (organizer) and words organizer refusals from the message catalogs, which already fixed the core of #882: the server's "no such connected app" no longer reaches the page. This PR is now just the wording that was left.

What changes

On Settings → Connected apps:

Case Before (main) After
Disconnect on an app already disconnected, from another tab say (?error=not_found) "No longer available." "That app is already disconnected."
Any other failed disconnect (?error=internal) "Could not disconnect. Try again." "Couldn’t disconnect. Try again."
  • organizer.errors.alreadyDisconnected is new and organizer.errors.disconnectFailed is reworded, both in en.json. connectedAppsLines (refusal-lines.ts) now gives the page its own line for not_found as well as internal. Every other code still gets the line every screen gives it, and a viewer's forbidden reads as everywhere else.
  • The old disconnect-refusal.ts, which returned hard-coded English, is gone. main's catalog rules don't allow English typed into an organizer screen.
  • page.tsx is unchanged from main.

Dropped: the list refresh. The first version also called revalidatePath before the error redirect, so an app that was already gone would drop out of the list. That isn't needed. I checked main's page as it is, under pnpm dev and under a production build (pnpm build && pnpm start), at desktop and phone width: after Disconnect on an app deleted behind the page, the redirect renders the page again and the list is already empty (1 row before, 0 after). So that part of #882 never happened on main.

Translation

Swedish is updated with the translate skill (organizer audience):

  • organizer.errors.alreadyDisconnected: "Appen är redan frånkopplad.", the same wording as the page's "Appen är frånkopplad." after a successful disconnect.
  • organizer.errors.disconnectFailed: the Swedish ("Det gick inte att koppla från. Försök igen.") still fits, since only the English apostrophe changed. Read against the new English and marked without a change.

to-translate.mjs sv now lists nothing for either audience.

Review: a different model (Sonnet) read both keys beside the rest of organizer.connectedApps in both catalogs, along with screenshots of the Swedish and English page showing each message, at 1280 and 390 pixels wide. Findings: none. It confirmed the meaning, the glossary's koppla från, the du tone, and that each message fits on one line on a phone. It had no view on the glossary's open questions, since none touch these keys.

Tests

  • page.test.tsx: the page shows each message for ?error=not_found and ?error=internal, in English, and in every other catalog language from that language's keys.
  • organizer-errors.test.ts: Connected apps' lines through refusalFromQuery, including a code it has no line of its own for.
  • organizer-reasons.test.ts (unchanged) still checks that every Connected apps refusal comes from the catalog.
  • Ran pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test (245 files, 3520 tests pass) and pnpm build && pnpm budgets (all pages within budget).
  • In the running app (production build, made-up accounts pat@example.com and an account storing Swedish), Disconnect on an app deleted behind the page shows the new line, in English and in Swedish, and leaves an empty list. ?error=internal shows the new failure line in both.

The help article on connecting an AI assistant doesn't quote either message, so it needs no change.

🤖 Generated with Claude Code

https://claude.ai/code/session_016YZ9SWNjJFtdBmT8WihHf8

Settings → Connected apps put the service's developer-facing "no such
connected app" straight into the error box when an organizer disconnected
an app that was already disconnected (from another tab, say). Map the
error code to plain words instead, the way the status and remove refusals
do, and revalidate the list so a stale row disappears.

Fixes #882.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9STHXfoMYjpHcFNwJ97
@richshaw richshaw added pipeline:ux Changes what a person using OpenSignup sees or does pipeline:working A session is working on it right now labels Nov 13, 2026 — with Claude
@richshaw
richshaw requested a balanced review from Copilot November 13, 2026 13:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@richshaw richshaw added pipeline:tophat pipeline:working A session is working on it right now and removed pipeline:working A session is working on it right now labels Nov 13, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Tophat: passed

I ran 549d84b locally with pnpm dev, using Postgres 16 and Chromium at 1280×900 and 390×844, with made-up data only (pat@example.com). To get a connected app, I went through the real OAuth consent screen as the e2e-client static client and clicked Allow. To get an app that's "already gone", I loaded Settings → Connected apps, deleted the grant's row behind the page (the same state a disconnect from another tab leaves), then clicked Disconnect on the stale page. I ran the same steps on the base, 001a284, first.

Check Result What I saw
Before (base 001a284): Disconnect on an app that's already gone ✅ reproduced Redirect to ?error=no%20such%20connected%20app, and the red box reads "no such connected app" (885-before-already-gone)
After: the same steps, desktop ✅ ?error=That%20app%20is%20already%20disconnected., and the red box reads "That app is already disconnected." The stale row is gone and the list shows "No connected apps" (885-after-already-gone)
After: the same steps, phone ✅ Same message, fits on one line with nothing cut off (885-after-phone-already-gone)
Neighbour: a normal Disconnect on a live app ✅ ?disconnected=1 and the green "Disconnected. It can no longer get new access…" notice, as before (885-after-normal-disconnect)
List with one connected app ✅ Shows "E2E test client" with its Disconnect button, unchanged (885-after-list)
Unexpected-error fallback ("Couldn’t disconnect. Try again.") ✅ (unit test) Can't be caused from the UI without breaking the database; disconnect-refusal.test.ts covers it. pnpm test on the folder: 5 passed
Console and server log ✅ No console errors on the settings page. The one 404 is the consent redirect to /e2e/oauth-callback, which only exists for the e2e tests. No connected-apps: disconnect failed line was logged for the expected refusal. The only server errors were the health check looking for pgboss.job, because I didn't run the worker

Not this PR, seen in passing: on the phone, the breadcrumb's last item ("Connected apps") wraps onto two lines and runs into the Help link in the header (visible in 885-after-phone-already-gone). It's the same header on main.

For the owner (UX): an organizer who clicks Disconnect on an app that was already disconnected (from another tab, say) now reads "That app is already disconnected." instead of the developer message "no such connected app". Any other failure now reads "Couldn’t disconnect. Try again." instead of "Could not disconnect. Try again.". Compare 885-before-already-gone with 885-after-already-gone.

Screenshots are in https://claude.ai/code/session_016YZ9STfnsZ1neVB8581Jrb.


Generated by Claude Code

@richshaw richshaw added pipeline:review pipeline:working A session is working on it right now and removed pipeline:tophat pipeline:working A session is working on it right now labels Nov 13, 2026 — with Claude

@richshaw richshaw left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: passed (round 1)

This PR maps the Disconnect action's failures to plain words, as #882 asks. Before, the action put serviceError.message into ?error=. Now it passes disconnectRefusal(code): not_found gives "That app is already disconnected.", and any other code, or no code at all (an unexpected error), gives "Couldn’t disconnect. Try again." The new helper has the same shape as status-refusal.ts and remove-refusal.ts. Logging works as before: unexpected errors are still logged, and a ServiceException refusal isn't. redirect() is called inside catch, not try, so NEXT_REDIRECT can't be caught by mistake. revalidatePath(PATH) now runs before the error redirect too, so the stale row is dropped. The only not_found that revokeConnectedApp throws (src/oauth/grants.ts:173) is the missing-grant case, so the wording fits. Every "Done when" item is met: the unit test pins not_found plus three other codes and undefined, and serviceError.message no longer goes into the URL. The help article doesn't quote this error. The CHANGELOG entry is accurate.

Blocking (0)
Optional (0)
Earlier threads: none. Copilot couldn't review (quota).
Checks: CI is green on 549d84b (lint-type-test, e2e, CodeQL), and the branch is up to date with main (001a284). The tophat passed on 549d84b, the head. I read the diff, revokeConnectedApp and the sibling refusal helpers. I didn't need to run anything locally to prove a finding.

Why the owner: this is UX. An organizer who disconnects an app that's already gone now reads "That app is already disconnected." where they used to read "no such connected app", and the generic failure now reads "Couldn’t disconnect. Try again." Compare 885-before-already-gone with 885-after-already-gone in the tophat session.

https://claude.ai/code/session_016YZ9SWUovHvvhXCkA2ydUW


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Approved by the owner at 549d84b.

Not merged yet: the branch now conflicts with main (mergeable_state: dirty). Sending it to pipeline:fix to merge main in. If that merge touches no code of the PR's own, this approval carries over and it can go straight back to pipeline:merge.

https://claude.ai/code/session_016YZ9SSnMjoyJ4iWMXTbyJg


Generated by Claude Code

@richshaw richshaw added pipeline:fix pipeline:working A session is working on it right now and removed pipeline:merge labels Nov 17, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Stopping here: the conflict with main needs a decision, because merging it means rewriting the PR, not just merging.

Since this PR opened (base 001a284), main moved the page to src/app/(organizer)/app/(chrome)/settings/connected-apps/ and put organizer text in the message catalogs. The Disconnect action now redirects with ?error=<code>, and the page words it through refusalFromQuery and connectedAppsLines (refusal-lines.ts). So the core of #882 is already on main: serviceError.message no longer goes into the URL. What main shows today:

  • App already gone (not_found): "No longer available." (the shared organizer.errors.code.not_found). This PR said "That app is already disconnected."
  • Unexpected error: "Could not disconnect. Try again." (organizer.errors.disconnectFailed). This PR said "Couldn’t disconnect. Try again."
  • Stale row: main doesn't call revalidatePath before the error redirect, so the already-gone app still shows. This PR did.

A trial merge conflicts in page.tsx and CHANGELOG.md, and this PR's disconnect-refusal.ts returns hard-coded English, which main's lint and catalog rules don't allow on organizer screens. Your approval was for English strings in that helper, so it wouldn't carry over to a rewrite. Options:

  1. Rebuild on main. Add a not_found line ("That app is already disconnected.") to connectedAppsLines, change disconnectFailed to "Couldn’t disconnect. Try again.", translate both into Swedish with the translate skill, add revalidatePath(PATH) before the error redirect, and drop disconnect-refusal.ts. Then it goes back through tophat and review, and to you again since it's UX.
  2. Close this PR and Disconnecting an app that's already gone shows "no such connected app" in a red box #882 as covered by main, and file the leftover (the wording and the stale row) as a new issue if you want it.

I pushed nothing and left the branch as it was. Labelled pipeline:stuck until you decide.

Session: https://claude.ai/code/session_016YZ9SW7egY2cFvqa1GJa4i


Generated by Claude Code

@richshaw richshaw removed the pipeline:working A session is working on it right now label Nov 17, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Merged main in at aeca716. The only conflict was CHANGELOG.md, against #1026's entry: I kept both entries, with this PR's first. The catalogs (en.json, sv.json, translated-from/sv.json, en.d.json.ts) merged cleanly.

Ran and passed: pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test (245 files, 3520 tests).

No tophat has passed yet on the rebuilt code (0205b62), so it goes back to pipeline:tophat once CI is green.

https://claude.ai/code/session_016YZ9SSrXmBYEKU54oeMPzi


Generated by Claude Code

@richshaw richshaw added pipeline:tophat pipeline:working A session is working on it right now and removed pipeline:fix pipeline:working A session is working on it right now labels Nov 18, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Merged main in at 2f033eb. As last time, the only conflict was CHANGELOG.md, this time against #881's entry (#884). I kept both entries, with this PR's first. Everything else, the catalogs included, merged cleanly. No code of the PR's own changed.

Ran and passed: pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test (246 files, 3521 tests).

No tophat has passed yet on the rebuilt code (0205b62), so it stays at pipeline:tophat once CI is green.

https://claude.ai/code/session_016YZ9SUQgoWBCjsRZy12vMm


Generated by Claude Code

@richshaw richshaw added pipeline:working A session is working on it right now and removed pipeline:working A session is working on it right now labels Nov 18, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Tophat: passed

I ran 2f033eb locally with pnpm dev, using Postgres 16 and Chromium at 1280×900 and 390×844. All data was made up: pat@example.com, and kim.sv@example.com, whose account stores Swedish. I inserted connected apps (Grant rows) with SQL. To make "already disconnected", I loaded the page and then deleted that app's row before clicking Disconnect.

Check Result What I saw
Before (base 9420f21): Disconnect on an app deleted behind the page ✅ reproduced Redirects to ?error=not_found and shows "No longer available." (885-before-already-gone)
After, the same steps ✅ ?error=not_found shows "That app is already disconnected." The deleted app is gone from the list and the other app is still there (885-after-already-gone)
?error=internal ✅ "Couldn’t disconnect. Try again." (885-after-internal)
Neighbour: a normal Disconnect ✅ ?disconnected=1, the usual "Disconnected. It can no longer get new access…" notice, and the empty state (885-after-real-disconnect)
Other codes ✅ ?error=forbidden shows the shared line "You don’t have edit access.", and an unknown ?error=bogus shows no alert, the same as main
Phone, English ✅ Same message, and the page doesn't scroll sideways (885-after-phone-already-gone)
Swedish organizer, phone ✅ <html lang="sv">. Koppla från on a deleted app shows "Appen är redan frånkopplad.", and ?error=internal shows "Det gick inte att koppla från. Försök igen." Each fits on one line at 390 px, with no English on the page (885-after-sv-phone-already-gone, 885-after-sv-phone-internal)
pnpm test for the connected-apps page, organizer-errors, organizer-reasons and the catalog check ✅ 5 files, 64 tests passed
Browser console, server log ✅ No console errors, and no server errors besides the health check's pgboss.job query (the worker wasn't running)

Not from this PR: on a phone, the Swedish header's crumbs overlap Hjälp and Konto (visible at the top of 885-after-sv-phone-already-gone). That's the problem already filed as #978, and main does the same.

For the owner (UX): on Settings → Connected apps, clicking Disconnect on an app that's already gone (disconnected in another tab, say) used to say "No longer available." It now says "That app is already disconnected." (Swedish: "Appen är redan frånkopplad."). A disconnect that fails for any other reason now reads "Couldn’t disconnect. Try again." instead of "Could not disconnect. Try again." Nothing else on the page changes. 885-before-already-gone and 885-after-already-gone show the difference.

Screenshots are in https://claude.ai/code/session_016YZ9STGQxC6ipYDNEWxFYA.


Generated by Claude Code

@richshaw richshaw added pipeline:review pipeline:working A session is working on it right now and removed pipeline:tophat pipeline:working A session is working on it right now labels Nov 18, 2026 — with Claude

@richshaw richshaw left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: passed (round 2)

This PR is the rebuilt version of the #882 fix (option 1 in the hand-back comment). It gives Settings → Connected apps its own line for not_found ("That app is already disconnected.") and rewords disconnectFailed to "Couldn’t disconnect. Try again." Both strings come from the catalog through connectedAppsLines, and every other code still gets the shared line. The page's disconnect action is unchanged from main. It redirects with ?error=<code> for a ServiceException, and with internal (logged) for anything else. The only not_found that revokeConnectedApp throws (src/oauth/grants.ts:173) is the case where the organizer has no such grant, so "already disconnected" is accurate. Each of the description's claims holds. disconnect-refusal.ts is gone, and nothing on the branch still uses "Could not disconnect" or the old helper. page.tsx is identical to main's. Swedish has both keys, translated-from/sv.json records the new English for both, and en.d.json.ts is regenerated. Dropping the revalidatePath part is backed by the tophat, which saw the deleted app gone from the list after the redirect. The tests pin both lines in English and in every other catalog language, and pin a code with no line of its own (rate_limited) still falling back to the shared line. The connected-apps help article doesn't quote either message. The CHANGELOG entry is accurate.

Blocking (0)
Optional (0)
Earlier threads: none. Copilot couldn't review (quota).
Checks: CI is green on 2f033eb (lint-type-test, e2e, CodeQL), and mergeable_state is clean against main (9420f21). The tophat passed on 2f033eb, the head. Locally I read the diff, the action in page.tsx and revokeConnectedApp, and searched for leftovers of the old wording. I didn't need to run anything to prove a finding.

Why the owner: this is UX, and the approval at 549d84b doesn't carry over, because the PR was rewritten on main. On Connected apps, Disconnect on an app that's already gone now says "That app is already disconnected." (Swedish: "Appen är redan frånkopplad."), where main says "No longer available." Any other failure reads "Couldn’t disconnect. Try again." Compare 885-before-already-gone with 885-after-already-gone, and see 885-after-sv-phone-already-gone, in the latest tophat's session.

https://claude.ai/code/session_016YZ9SUA1WmahVibZZdHdts


Generated by Claude Code

@richshaw richshaw added pipeline:owner Passed; waits for the owner (UX or high-risk) pipeline:merge pipeline:working A session is working on it right now and removed pipeline:review pipeline:working A session is working on it right now pipeline:owner Passed; waits for the owner (UX or high-risk) labels Nov 18, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Approved by the owner at 2f033eb.

The owner approved this head in a live session and asked for it to be merged after #871. Every gate passes at 2f033eb: CI green, review round 2 verdict=pass, tophat result=pass, no open threads, and main is green. The branch is behind main; a trial merge onto main with #871 merged in is clean (the catalogs merge without conflicts). Once #871 lands, this branch gets updated from main, which adds no commits of its own, so this approval carries over, and it merges when CI passes on that head.

https://claude.ai/code/session_016YZ9SUTbBzWCJ45BqmkVnV


Generated by Claude Code

@richshaw
richshaw merged commit de5e279 into main Nov 18, 2026
5 checks passed
@richshaw
richshaw deleted the claude/issue-882-disconnect-refusal branch November 18, 2026 23:15
@richshaw richshaw removed pipeline:merge pipeline:ux Changes what a person using OpenSignup sees or does pipeline:working A session is working on it right now labels Nov 18, 2026 — with Claude
richshaw pushed a commit that referenced this pull request Nov 18, 2026
The only conflict was CHANGELOG.md, against #885's entry under Fixed.
Kept both entries, with this PR's first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SUTbBzWCJ45BqmkVnV
richshaw pushed a commit that referenced this pull request Nov 18, 2026
main (#885) added organizer.errors.alreadyDisconnected and changed
disconnectFailed's English from "Could not" to "Couldn't". German gets
"Diese App ist schon getrennt." (trennen, as the glossary says), and its
disconnectFailed line, which still says the same, is marked against the
new English.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SU3Lv9FSy3pvxEE8zf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disconnecting an app that's already gone shows "no such connected app" in a red box

3 participants